package com.dubbo.gmail.controller;

import com.dubbo.gmail.api.service.CallbackListener;
import com.dubbo.gmail.api.service.CallbackService;
import lombok.extern.log4j.Log4j2;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Log4j2
@Controller
public class CallBackController {

    @DubboReference
    CallbackService callbackService;

    @RequestMapping("/change")
    public String change() {
        callbackService.addListener("dema", new CallbackListener() {
            @Override
            public void changed(String msg) {
                log.info(msg);
            }
        });
        return "1";
    }
}
